package com.pengtu.gsj.entity.zxgc;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import org.springframework.context.annotation.Lazy;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.pengtu.gsj.entity.app.Attachment;
import com.pengtu.gsj.entity.base.IdEntity;
/**
 * 
 * 专项工程实体类
 * SpecialProject
 * 
 * 2017年8月1日 下午1:51:42
 * @author zl
 * @version 1.0.0
 *
 */
@Entity
@Table(name = "T_YH_SPECIALPROJECT")
@JsonIgnoreProperties(value = {"projectDatas"})
public class SpecialProject extends IdEntity {
	
	/**
	 * serialVersionUID:TODO
	 *
	 * @since 1.0.0
	 */
	
	private static final long serialVersionUID = 7149741333343664513L;
	private String projectName; //工程名称
	private String projectDesc; //工程描述
	private Date endTime; //截止时间
	private String advanceTime; //提前时间（小时）
	private String frequency; //预警频率
	private String status; //状态 0 正常 1 作废
	private String dataTab; //数据标签
	private String remark; //备注
	private String year; //工程年份信息
	private long count;
	
	private List<ProjectData> projectDatas =  new ArrayList<ProjectData>();
	private List<String> tabList = new ArrayList<String>();
	
	private List<Attachment> attachments = new ArrayList<Attachment>();
	
	public SpecialProject() {
		
	}
	
	public SpecialProject(String year, long count) {
		this.year = year;
		this.count = count;
	}
	
	public SpecialProject(String year, String status, long count) {
		this.year = year;
		this.status = status;
		this.count = count;
	}
	
	@Column(name = "PROJECTNAME")
	public String getProjectName() {
		return projectName;
	}
	public void setProjectName(String projectName) {
		this.projectName = projectName;
	}
	@Column(name = "PROJECTDESC")
	public String getProjectDesc() {
		return projectDesc;
	}
	public void setProjectDesc(String projectDesc) {
		this.projectDesc = projectDesc;
	}
	@Temporal(TemporalType.DATE)
	@Column(name = "ENDTIME", length = 10)
	public Date getEndTime() {
		return endTime;
	}
	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}
	@Column(name = "ADVANCETIME")
	public String getAdvanceTime() {
		return advanceTime;
	}
	public void setAdvanceTime(String advanceTime) {
		this.advanceTime = advanceTime;
	}
	@Column(name = "FREQUENCY")
	public String getFrequency() {
		return frequency;
	}
	public void setFrequency(String frequency) {
		this.frequency = frequency;
	}
	@Column(name = "STATUS")
	public String getStatus() {
		return status;
	}
	public void setStatus(String status) {
		this.status = status;
	}
	@Column(name = "DATATAB")
	public String getDataTab() {
		return dataTab;
	}
	public void setDataTab(String dataTab) {
		this.dataTab = dataTab;
	}
	@Column(name = "REMARK")
	public String getRemark() {
		return remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
	
	@OneToMany(mappedBy="specialProject")
	@Lazy(true)
	public List<ProjectData> getProjectDatas() {
		return projectDatas;
	}
	public void setProjectDatas(List<ProjectData> projectDatas) {
		this.projectDatas = projectDatas;
	}
	@Transient
	public List<String> getTabList() {
		tabList = Arrays.asList(getDataTab().split(";"));
		return tabList;
	}
	public void setTabList(List<String> tabList) {
		this.tabList = tabList;
	}
	@OneToMany(fetch = FetchType.LAZY)
	@JoinColumn(name = "PARTID")
	public List<Attachment> getAttachments() {
		return attachments;
	}

	public void setAttachments(List<Attachment> attachments) {
		this.attachments = attachments;
	}
	
	@Column(name = "YEAR")
	public String getYear() {
		return year;
	}
	public void setYear(String year) {
		this.year = year;
	}

	@Transient
	public long getCount() {
		return count;
	}

	public void setCount(long count) {
		this.count = count;
	}
	
	
	
	
}
